<?php   // $Id: client_edit.php 275 2008-08-12 20:41:04Z pcoustillas $ ?>
<?php   
/*Copyright (C) 2003-2004 Guy Hendrickx
Licensed under the terms of the GNU  General Public License:http://www.opensource.org/licenses/gpl-license.php
File Authors:Guy Hendrickx
Modification : Pierre Coustillas */

require_once("include/verif.php");
require_once("include/config/common.php");
require_once("include/language/$lang.php");
require_once("include/utils.php");
require_once("include/headers.php");

?>

<script language="javascript" src="javascripts/verifier_form.js" type="text/javascript"></script>
<script type="text/javascript">
function verif_form()
{
	if (verifier('edit_client','black','nom','vide#carac_spec','login','carac_spec','pass','carac_spec','mail','mail'))
	{
		document.edit_client.submit();
	} else {
		alert("<?php aff_lang('Une des valeurs saisies n\'est pas correcte. \nMerci de corriger avant de poursuivre. ') ?>")	
	}

}
</script>

<table width="760" border="0" class="page" align="center">
	<tr>
		<td class="page" align="center">
		<?php
		require_once("include/head.php");
		?>
		</td>
	</tr>
	<tr>
		<td class="page" align="center"> 
			<?php
			if (isset($_GET['message']))
			{
				echo "<h1>" . $_GET['message'] . "</h1>";
			}
			?>
		</td>
	</tr>
	<tr>
		<td>
			<?php
			$num=isset($_GET['num'])?$_GET['num']:"";
			$sql = " SELECT * FROM ${tblpref}client WHERE num_client='$num'";
			$req = mysql_query($sql) or die("Erreur SQL !<br/>$sql2<br/>" . mysql_error());
			while($data = mysql_fetch_array($req))
			{
				$nom = $data['nom'];
				$nom2 = $data['nom2'];
				$rue = $data['rue'];
				$ville = $data['ville'];
				$cp = $data['cp'];
				$tva = $data['num_tva'];
				$mail =$data['mail'];
				$login = $data['login'];
				$civ = $data['civ'];
				$tel = $data['tel'];
				$fax = $data['fax'];
			}
			?>
			<center>
			<form name="edit_client" method="post" action="client_update.php" onsubmit="return confirmUpdate()">
			<table width="70%">
				<caption>
				<?php echo get_lang("Modifier la fiche client de") . " $nom"; ?> &nbsp;  &nbsp;  &nbsp; <?php bouton_aide("client") ?>
				</caption>
				<tr>
					<td class="texte0">Civilité</td>
					<td class="texte0">
						<input name="civ" type="text" value='<?php echo "$civ"; ?>' />
					</td>
				</tr>
				<tr>
					<td class="texte1" id="nom"><?php echo $lang_nom; ?> <strong>*</strong></td>
					<td class="texte1">
						<input name="nom" type="text" value="<?php echo "$nom"; ?>" />
					</td>
				</tr>
				<tr>
					<td class="texte0"><?php echo $lang_complement; ?> </td>
					<td class="texte0">
						<input name="nom_sup" type="text" value='<?php echo "$nom2"; ?>' />
					</td>
				</tr>
				<tr>
					<td class="texte1"><?php echo $lang_rue; ?></td>
					<td class="texte1">
						<input name="rue" type="text" value='<?php echo "$rue"; ?>' />
					</td>
				</tr>
				<tr>
					<td class="texte0"><?php echo $lang_code_postal; ?></td>
					<td class="texte0">
						<input name="code_post" type="text" value="<?php echo "$cp"; ?>" />
					</td>
				</tr>
				<tr>
					<td class="texte1"><?php echo $lang_ville; ?></td>
					<td class="texte1">
						<input name="ville" type="text" value="<?php echo "$ville"; ?>" />
					</td>
				</tr>
				<tr>
					<td class="texte0"><?php echo $lang_numero_tva; ?></td>
					<td class="texte0">
						<input name="num_tva" type="text" value="<?php echo "$tva"; ?>" />
					</td>
				</tr>
				<tr>
					<td class="texte1"><?php aff_lang("Téléphone") ?></td>
					<td class="texte1">
						<input name="tel" type="text" value='<?php echo "$tel"; ?>' />
					</td>
				</tr>
				<tr>
					<td class="texte0"><?php aff_lang("Fax") ?></td>
					<td class="texte0">
						<input name="fax" type="text" value='<?php echo "$fax"; ?>' />
					</td>
				</tr>
				<tr>
					<td class="texte1" id="mail"><?php  echo $lang_email; ?> </td>
					<td class="texte1">
						<input name="mail" type="text" value="<?php echo "$mail"; ?>" />
					</td>
				</tr>
				<tr>
					<td class="submit" colspan="2" >
						<u><?php aff_lang("Connexion client") ?></u>
						<br/>
						<?php aff_lang("Ces données sont optionnelles et permettront à ce client de consulter ses devis, commandes et factures en ligne. ") ?>
						<br/>	
						<?php aff_lang("Si vous avez renseigné le champ «&nbsp;E-mail&nbsp;» et que vous apportez des modifications aux données d'identification, un E-mail spécifiant ces nouvelles données lui sera envoyé. ") ?> 
					</td>
				</tr>
				</tr>
				<tr>
					<td class="texte0" id="login"><?php echo $lang_login; ?></td>
					<td class="texte0">
						<input name='login' type='text' value='<?php echo $login; ?>' />
					</td>
				</tr>
				<tr>
					<td class="texte1" id="pass">
						<?php aff_lang("Mot de passe. ") ?>
						<br/>
						<?php aff_lang("Ne saisissez une valeur que si vous souhaitez modifier le mot de passe, sinon laissez le champ vide. ") ?>
					</td>
					<td class="texte1"><input name="pass" type="text" /></td>
				</tr>
				<tr>
					<td class="submit" colspan="2">
						<input type="button" onclick="verif_form()" value="<?php echo $lang_envoyer; ?>" />
						<input name="num" type="hidden" value="<?php echo $num; ?>" />
					</td>
				</tr>
			</table>
			</form>
			</center>

		</td>
	</tr>
	<tr>
		<td>
			<?php
			require_once("include/bas.php");
			?>
		</td>
	</tr>

</table>
</body>
</html>
